 
#include<string.h>
#define NUM  101
#define STYLE '#'
#include "process.h"
#include <unistd.h>
void Flushprocess(double total,double current)
{
   char buff[NUM];
   memset(buff,0,sizeof(buff));
   const char* tatbles="/|-\\";
   int len=sizeof(tatbles);
   
   int num=current*100/total;
   for(int i=0;i<num;i++)
     buff[i]=STYLE;

   double  rate=current*100/total;
   static int cnt=0;
   cnt%=len;
   printf("[%-100s][%.1lf%%][%c]\r",buff,rate,tatbles[cnt]);
   cnt++;
   fflush(stdout);
   
}
void process()
{
  char buff[NUM];
  memset(buff,0,sizeof(buff));
  const char* tatbles="|/-\\";
  int len=sizeof(tatbles);

  int cnt=0;
  while(cnt<=100)
  {
    printf("[%-100s][%d%%][%c]\r",buff,cnt,tatbles[cnt%len]);
    fflush(stdout);
    buff[cnt]=STYLE;
    usleep(50000);
    cnt++;
  }
  printf("\n");
}

